import os

from django.conf.urls.defaults import *
from saip.usuario.views import *
from saip.proyecto.views import *
from django.contrib.auth.views import login
from django.views.generic.simple import direct_to_template
from saip.usuario.models import Rol

site_media = os.path.join(
    os.path.dirname(__file__), 'site_media'
)


# Uncomment the next two lines to enable the admin:
#from django.contrib import admin
#from django.contrib.auth.models import User
#admin.autodiscover()

#admin.site.unregister(User)


urlpatterns = patterns('',
    # Example:
    # (r'^saip/', include('saip.foo.urls')),

    # Uncomment the admin/doc line below and add 'django.contrib.admindocs' 
    # to INSTALLED_APPS to enable admin documentation:
    # (r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    #(r'^admin/', include(admin.site.urls)),
	#(r'^$', login),
    (r'^$', main_page),
    (r'^login/$', 'django.contrib.auth.views.login'),
    #(r'^user_save/$', crear_usuario),
    (r'^logout/$', logout),
    (r'^site_media/(?P<path>.*)$', 'django.views.static.serve',
        {'document_root': site_media}),
    (r'^restringido/$', direct_to_template,
        {'template': 'registration/no_perm.html'}),
	#ABM usuario
    (r'^user_save/$', crear_usuario),
    (r'^user_save/success/$', direct_to_template,
        {'template': 'usuario/user_save_success.html'}),
    (r'^user_edit/$', editar_usuario),
    (r'^user_delete/$', eliminar_usuario),
    (r'^user_read/$', leer_usuario),
    (r'^change_password/$', change_password),
    #ABM rol
    (r'^rol_save/$', rol_save_page),
    (r'^rol_edit/$', editar_rol),
    (r'^rol_edit/cancel$', editar_rol),
    (r'^rol_delete/$', eliminar_rol),
    (r'^rol_read/$', leer_rol),
    (r'^rol/success/$', direct_to_template,
        {'template': 'rol/rol_success.html'}),
	#ABM permiso
    #(r'^permiso_save/$', permiso_save_page),
    #(r'^permiso_edit/$', editar_permiso),
    #(r'^permiso_edit/cancel$', editar_permiso),
    #(r'^permiso_delete/$', eliminar_permiso),
    #(r'^permiso_delete/cancel$', eliminar_permiso),
    #(r'^permiso/success/$', direct_to_template,
    #    {'template': 'permiso/permiso_success.html'}),
	#ABM proyecto
    (r'^proyecto_save/$', crear_proyecto),
    (r'^proyecto/success/$', direct_to_template,
       {'template': 'proyecto/proyecto_success.html'}),
    (r'^proyecto_edit/$', editar_proyecto),
    (r'^proyecto_edit/cancel$', editar_proyecto),
    (r'^proyecto_delete/$', eliminar_proyecto),
    (r'^proyecto_read/$', leer_proyecto),
    (r'^proyecto_delete/cancel$', eliminar_proyecto),
    #ABM tipo de artefacto general
    (r'^tipoartgral_save/$', crearTipoArtefactoGral),
    (r'^tipoartgral_edit/$', editar_tipoartgral),
    (r'^tipoartgral_read/$', leer_tipoartgral),
    (r'^tipoartgral_delete/$', eliminar_tipoartgral),
	#ABM tipo de artefacto
    (r'^tipoart_save/$', crearTipoArtefacto),
    (r'^tipoart_edit/$', editar_tipoart),
    (r'^tipoart_read/$', leer_tipoart),
    (r'^tipoart_delete/$', eliminar_tipoart),
	#ABM artefacto analisis
    (r'^artan_save/$', crearArtefactoAn),
    (r'^artan_read/$', leer_artefactoan),
    (r'^artan_edit/$', editar_artefactoan),
    (r'^artan_delete/$', eliminar_artefactoan),
    (r'^linbase_an/$', gen_lineaba_an),
    (r'^aprobar_an/$', apro_artan),
    (r'^pro_impacto_an/$', impacto_pro_an),
    (r'^reg_impacto_an/$', impacto_reg_an),
    #ABM artefacto disenho
    (r'^artdi_save/$', crearArtefactoDi),
    (r'^artdi_read/$', leer_artefactodi),
    (r'^artdi_edit/$', editar_artefactodi),
    (r'^artdi_delete/$', eliminar_artefactodi),
    (r'^linbase_di/$', gen_lineaba_di),
    (r'^aprobar_di/$', apro_artdi),
    (r'^pro_impacto_di/$', impacto_pro_di),
    (r'^reg_impacto_di/$', impacto_reg_di),
    #ABM artefacto implementacion
    (r'^artim_save/$', crearArtefactoIm),
    (r'^artim_read/$', leer_artefactoim),
    (r'^artim_edit/$', editar_artefactoim),
    (r'^artim_delete/$', eliminar_artefactoim),
    (r'^linbase_im/$', gen_lineaba_im),
    (r'^aprobar_im/$', apro_artim),
    (r'^pro_impacto_im/$', impacto_pro_im),
    (r'^reg_impacto_im/$', impacto_reg_im),
	#(r'^login/enlazar/$', enlazar),
	(r'^asing_adm/$', asignar_rol_adm),
	#Proyectos de Usuarios Logueados Actualmente
	#(r'^proyecto_list/$', proyecto_page),
    (r'^dev_page/$', desarrolo_page),
    (r'^asing_op/$', asignar_rol_op),
    #Historial
    (r'^historial_an/$', ver_historial_an),
    (r'^historial_di/$', ver_historial_di),
    (r'^historial_im/$', ver_historial_im),
    (r'^restaurar_an/$', restaurar_an),
    (r'^restaurar_di/$', restaurar_di),
    (r'^restaurar_im/$', restaurar_im),
    (r'^adjunto/$', bajaradjunto),
)
